﻿using System.Collections.Generic;
using System.Threading.Tasks;
using OS.Common.Core;
using Sample.Test.WebApi.Model;

namespace Sample.Test.WebApi.DAL
{
    public class PcSpiderRepository : BaseContext, IPcSpiderRepository
    {
        public PcSpiderRepository()
        {
            SourceTableName = "pc_spider";
        }

        /// <summary>
        /// 查询所有爬虫数据
        /// </summary>
        /// <param name="status">数据状态，0、未用，1、已用</param>
        /// <returns></returns>
        public async Task<PageListResult<pc_spider>> GetList(int status)
        {
            var param = new Dictionary<string, object>();
            param.Add("@status", status);
            return await GetList<pc_spider>($"select * from {SourceTableName} where status = @status", $"select count(1) from {SourceTableName} where status = @status", param);
        }
    }
}